<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>跳转页面</title>
</head>
<body>
<%
    def iframe = Math.round(Math.random()*1000000)
    %>
<!-- 你的HTML代码 -->
<div class="main_page">
    <iframe scrolling="auto" id="${iframe}" name="${iframe}" frameborder="0"  src="../xxdsqljob/${request.getParameter("pageName")}"
            style="width:100%;height:850px;padding: 3px"></iframe>
</div>

</body>
</html>

<script>
    // 计算页面的实际高度，iframe自适应会用到
    function calcPageHeight(doc) {
        var cHeight = Math.max(doc.body.clientHeight, doc.documentElement.clientHeight)
        var sHeight = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight)
        var height  = Math.max(cHeight, sHeight)
        return height
    }
    //根据ID获取iframe对象
    var ifr = document.getElementById('${iframe}')
    ifr.onload = function() {
        //解决打开高度太高的页面后再打开高度较小页面滚动条不收缩
        ifr.style.height='0px';
        var iDoc = ifr.contentDocument || ifr.document
        var height = calcPageHeight(iDoc)
        if(height < 850){
            height = 850;
        }
        // ifr.style.height = $(window).height() + 'px'
        console.log($(window).height())
        $("#"+"${iframe}").css("min-height",$(window).height())
    }

    $("#"+"${iframe}").css("min-height",$(window).height()-70)
</script>